package com.warm.pump.module.skd.service.impl;

import com.warm.pump.frame.gen.bean.PageBean;
import com.warm.pump.module.skd.bean.po.gen.ScheduleInstanceDtl;
import com.warm.pump.module.skd.dao.gen.ScheduleInstanceDtlDao;
import com.warm.pump.module.skd.service.IScheduleInstanceDtlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service("ScheduleInstanceDtlService")
public class ScheduleInstanceDtlServiceImpl implements IScheduleInstanceDtlService {
    @Autowired
    private ScheduleInstanceDtlDao scheduleInstanceDtlDao;

    @Override
    public ScheduleInstanceDtl queryObject(Long id) {
        return scheduleInstanceDtlDao.selectByPrimaryKey(id);
    }

    public ScheduleInstanceDtl queryObject(Map<String, Object> map) {
        return scheduleInstanceDtlDao.selectByMap(map);
    }

    @Override
    public List<ScheduleInstanceDtl> queryList(Map<String, Object> map) {
        return scheduleInstanceDtlDao.getListByMap(map);
    }

    @Override
    public PageBean getPageBeanByMap(Map map, int pageNo, int pageSize) {
        return scheduleInstanceDtlDao.getPageBeanByMap(map, pageNo, pageSize);
    }


    @Override
    public int queryTotal(Map<String, Object> map) {
        return scheduleInstanceDtlDao.countTotalByMap(map);
    }

    @Override
    public void save(ScheduleInstanceDtl scheduleInstanceDtl) {
        scheduleInstanceDtlDao.insertSelective(scheduleInstanceDtl);
    }

    @Override
    public void update(ScheduleInstanceDtl scheduleInstanceDtl) {
        scheduleInstanceDtlDao.updateByPrimaryKeySelective(scheduleInstanceDtl);
    }

    @Override
    public void delete(Long id) {
        scheduleInstanceDtlDao.deleteByPrimaryKey(id);
    }

    @Override
    public void delete(Map<String, Object> map) {
        scheduleInstanceDtlDao.deleteByMap(map);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        Map<String, Object> map = new HashMap<>();
        map.put("id_in", ids);
        scheduleInstanceDtlDao.deleteByMap(map);
    }

}
